﻿using JV.Com.DesignViewModels;
using JV.Com.Internals;
using JV.Com.ViewModels;
using JV.Com.ViewModels.Wrapper;
using Microsoft.Practices.Prism.StoreApps;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace JV.Com.Views
{
    public sealed partial class DetailFolderPage : Page
    {
        private DetailFolderPageViewModel m_context;
        public DetailFolderPage()
        {
            this.InitializeComponent();
            this.DataContextChanged += DetailNewsPage_DataContextChanged;
            this.Loaded += DetailNewsPage_Loaded;
        }

        void DetailNewsPage_Loaded(object sender, RoutedEventArgs e)
        {
            m_context.FolderUpdatedEvent += (s, args) =>
            {
                richBlock.Blocks.Add(m_context.Paragraph);
                m_context.InLoading = false;
            };
        }

        void DetailNewsPage_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (args.NewValue is DetailFolderPageViewModel)
            {
                m_context = (DetailFolderPageViewModel)args.NewValue;
            }
        }
    }
}
